home *** CD-ROM | disk | FTP | other *** search
- class classes.enemy.SpaceManA
- {
- var x;
- var y;
- var moveScript;
- var matrixCoords;
- var form;
- var id;
- var clip;
- var colorR;
- var trans;
- var colorTrans;
- var advanceMax;
- var advanceMax2;
- var matrixVar;
- var laser;
- var dir;
- var axis;
- var xDest;
- var yDest;
- var oldDir;
- var cMax;
- var xMov = 0;
- var yMov = 0;
- var xMovT = 0;
- var yMovT = 0;
- var speedOrig = 8;
- var speed = 8;
- var f2 = "";
- var xDestMet = false;
- var yDestMet = false;
- var c = 0;
- var c2 = 0;
- var moveScripted = true;
- var feelerInfo = [[-400,0,400,40],[0,0,400,40],[0,-400,40,400],[0,0,40,400]];
- var dirArray = ["L","R","U","D"];
- var life = 300;
- var nudging = false;
- var nc = 0;
- var xA = 0;
- var yA = 0;
- var power = 30;
- var hc = 0;
- var Name = "spaceManA";
- function SpaceManA(px, py, pmoveScript, pmatrixCoords, pform, pid)
- {
- this.x = px;
- this.y = py;
- this.moveScript = pmoveScript.slice();
- this.matrixCoords = pmatrixCoords.slice();
- this.form = pform.slice();
- this.id = pid;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("spaceManA","spaceManA" + this.id + "Clip",_root.d + 50000);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.speed *= _root.dif.speed;
- this.speedOrig = this.speed;
- this.life *= _root.dif.life;
- this.colorR = _root.randRange(-40,10);
- this.trans = new flash.geom.Transform(this.clip.body);
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,this.colorR,this.colorR,this.colorR,0);
- this.trans.colorTransform = this.colorTrans;
- this.advanceMax = 60 / (this.speed / 2);
- this.advanceMax2 = 50 / (this.speed / 2);
- if(this.matrixCoords[0] == "free")
- {
- this.matrixVar = 0;
- }
- else
- {
- this.matrixVar = 1;
- }
- this.speedVar();
- this.laser = new Object();
- this.parseMoveScript();
- _root.stats.created = _root.stats.created + 1;
- }
- function broBehind()
- {
- this.dir = _root.advanceDir;
- }
- function bombed(num)
- {
- num;
- this.life -= num;
- if(this.life < 1)
- {
- this.f2 = "death";
- }
- else
- {
- this.nudge(_root.randRange(-6,6),_root.randRange(-6,6),100);
- }
- }
- function nudge(pxA, pyA, pscale)
- {
- this.nc = 0;
- this.nudging = true;
- var _loc2_ = pscale / 100;
- this.xA = pxA * _loc2_;
- this.yA = pyA * _loc2_;
- }
- function speedVar()
- {
- if(random(3) == 1)
- {
- this.speed *= _root.randRange2(0.9999,1.0001);
- }
- }
- function parseMoveScript()
- {
- this.dir = this.moveScript[0];
- if(this.dir == "break")
- {
- this.moveScripted = false;
- delete this.moveScript;
- if(this.matrixCoords[0] == "free")
- {
- this.f2 = "wander";
- this[this.axis + "MovT"] = 0;
- this.axis = random(10) <= 4 ? "y" : "x";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.speedVar();
- this.getDirString();
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.xDest = _root.advanceDir != "L" ? this.matrixCoords[0] * 60 : this.matrixCoords[0] * 60 + 320;
- this.yDest = this.matrixCoords[1] * 50 + 10;
- this.axis = Math.abs(this.xDest - this.x) <= Math.abs(this.yDest - this.y) ? "y" : "x";
- this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
- this.getDirString();
- this.speedVar();
- this.f2 = "gotoMatrix";
- }
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.f2 = "gotoXYDest";
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.speedVar();
- if(this.dir == "L" || this.dir == "U")
- {
- this[this.axis + "Dest"] = this[this.axis] - this.moveScript[1];
- }
- else
- {
- this[this.axis + "Dest"] = this[this.axis] + this.moveScript[1];
- }
- this.moveScript.splice(0,2);
- }
- }
- function gotoXYDest()
- {
- if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
- {
- if(this.axis == "x")
- {
- this.x = this.xDest;
- }
- else
- {
- this.y = this.yDest;
- }
- this.parseMoveScript();
- }
- }
- function gotoMatrix()
- {
- if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
- {
- if(this.axis == "x")
- {
- this.x = this.xDest;
- }
- else
- {
- this.y = this.yDest;
- }
- this[this.axis + "MovT"] = 0;
- this.axis = this.axis != "x" ? "x" : "y";
- this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
- this.getDirString();
- this.speed = this.speedOrig;
- }
- if(Math.abs(this.x - this.xDest) < this.speed + 1 && Math.abs(this.y - this.yDest) < this.speed + 1)
- {
- this.x = this.clip._x = this.xDest;
- this.y = this.clip._y = this.yDest;
- this.xMovT = this.xMov = 0;
- this.yMovT = this.yMov = 0;
- this.matrixVar = 2;
- this.dir = _root.advanceDir;
- this.clip.body.gotoAndPlay("flyEnd");
- this.clip.flame.gotoAndStop("wait");
- this.clip.gotoAndStop(this.dir);
- this.oldDir = "matrix";
- _root.matrixNum = _root.matrixNum + 1;
- if(_root.matrixNum >= _root.matrixSize)
- {
- _root.matrixComplete = true;
- }
- _root["formB" + this.form[0]] = "matrixed";
- this.f2 = "wait";
- }
- }
- function getDirString()
- {
- if(this.xMovT < -1)
- {
- this.dir = "L";
- }
- else if(this.xMovT > 1)
- {
- this.dir = "R";
- }
- else if(this.yMovT > 1)
- {
- this.dir = "D";
- }
- else if(this.yMovT < -1)
- {
- this.dir = "U";
- }
- }
- function evade()
- {
- if(this.matrixVar == 2)
- {
- this.matrixVar = 0;
- this.clip.flame.gotoAndPlay("flyStart");
- this.clip.body.gotoAndPlay("flyStart");
- this.f2 = "wander";
- }
- else if(this.f2 == "charging")
- {
- this.newChargeDir();
- }
- else if(this.f2 == "laserScoping" || this.laser.firing)
- {
- this.stopLaserFire();
- }
- }
- function wait()
- {
- if(random(1000) >= 998 && _root.matrixComplete)
- {
- this.dir = this.findDir();
- if(this.dir == _root.advanceDir)
- {
- this.matrixVar = 0;
- this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
- if(random(2) > 0)
- {
- this.clip.flame.gotoAndPlay("flyStart");
- this.clip.body.gotoAndPlay("flyStart");
- this.f2 = "wander";
- }
- else
- {
- this.charge();
- }
- }
- else if(this.dir == "U" || this.dir == "D")
- {
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.matrixVar = 0;
- this.c = 0;
- this.f2 = "leavingMatrix";
- }
- else
- {
- this.dir = _root.advanceDir;
- }
- }
- }
- function leavingMatrix()
- {
- this.c = this.c + 1;
- if(this.c > this.advanceMax2)
- {
- this.c = 0;
- this.dir = this.findDir();
- if(this.dir == _root.advanceDir)
- {
- this.yMovT = 0;
- this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
- if(random(2) > 0)
- {
- this.f2 = "wander";
- }
- else
- {
- this.charge();
- }
- }
- }
- }
- function findDir()
- {
- _root.d = _root.d + 1;
- _root.attachMovie("feeler","feelerClip",_root.d);
- var _loc7_ = [];
- var _loc9_ = 0;
- var _loc11_ = this.dirArray.length;
- while(_loc9_ < _loc11_)
- {
- _root.feelerClip._x = this.x + this.feelerInfo[_loc9_][0];
- _root.feelerClip._y = this.y + this.feelerInfo[_loc9_][1];
- _root.feelerClip._width = this.feelerInfo[_loc9_][2];
- _root.feelerClip._height = this.feelerInfo[_loc9_][3];
- var _loc3_ = 0;
- var _loc8_ = _root.chars.length;
- var _loc6_ = false;
- while(_loc3_ < _loc8_)
- {
- var _loc5_ = _root.chars[_loc3_] + "Clip";
- if(_root.feelerClip.hitTest(_root[_loc5_]))
- {
- var _loc4_ = _root.chars[_loc3_];
- if(_root[_loc4_].matrixVar == 2 && _loc4_ != this.Name + this.id)
- {
- _loc6_ = true;
- break;
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- if(!_loc6_)
- {
- var _loc10_ = _root.advanceDir != "L" ? "L" : "R";
- if(this.dirArray[_loc9_] != _loc10_)
- {
- _loc7_.push(this.dirArray[_loc9_]);
- }
- }
- _loc9_ = _loc9_ + 1;
- }
- _loc9_ = 0;
- _loc11_ = _loc7_.length;
- if(_loc9_ < _loc11_)
- {
- if(_loc7_[_loc9_] == _root.advanceDir)
- {
- return _root.advanceDir;
- }
- return _loc7_[random(_loc7_.length)];
- }
- }
- function death()
- {
- _root.stats.destroyed = _root.stats.destroyed + 1;
- _root.stats.score += 50000;
- _root.powerUp(this.x,this.y,50);
- if(this.matrixVar == 1)
- {
- _root.matrixNum = _root.matrixNum + 1;
- if(_root.matrixNum >= _root.matrixSize)
- {
- _root.matrixComplete = true;
- }
- }
- var _loc3_ = 0;
- var _loc4_ = _root["form" + this.form[0]].length;
- while(_loc3_ < _loc4_)
- {
- if(_root["form" + this.form[0]][_loc3_] == "spaceManA" + this.id)
- {
- _root["form" + this.form[0]].splice(_loc3_,1);
- if(_root["form" + this.form[0]].length == 0)
- {
- delete _root["form" + this.form[0]];
- if(_root["formB" + this.form[0]] == "matrixed")
- {
- _loc3_ = 0;
- _loc4_ = random(2) + 1;
- while(_loc3_ < _loc4_)
- {
- _root.createPowerUp([this.x,this.y,"coin25"]);
- _loc3_ = _loc3_ + 1;
- }
- _loc3_ = 0;
- _loc4_ = random(2) + 1;
- while(_loc3_ < _loc4_)
- {
- _root.createPowerUp([this.x,this.y,"coin10"]);
- _loc3_ = _loc3_ + 1;
- }
- _loc3_ = 0;
- _loc4_ = random(2) + 2;
- while(_loc3_ < _loc4_)
- {
- _root.createPowerUp([this.x,this.y,"coin5"]);
- _loc3_ = _loc3_ + 1;
- }
- _root.stats.score += 50000;
- }
- else
- {
- _loc3_ = 0;
- _loc4_ = random(2) + 2;
- while(_loc3_ < _loc4_)
- {
- _root.createPowerUp([this.x,this.y,"coin25"]);
- _loc3_ = _loc3_ + 1;
- }
- _loc3_ = 0;
- _loc4_ = random(3) + 2;
- while(_loc3_ < _loc4_)
- {
- _root.createPowerUp([this.x,this.y,"coin10"]);
- _loc3_ = _loc3_ + 1;
- }
- _root.stats.score += 100000;
- }
- delete _root["formB" + this.form[0]];
- }
- break;
- }
- _loc3_ = _loc3_ + 1;
- }
- _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-20,20),this.y + this.clip._height / 2 + _root.randRange(-20,20),_root.randRange(80,130),_root.randRange(75,100),"Red"]);
- _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-20,20),this.y + this.clip._height / 2 + _root.randRange(-20,20),_root.randRange(80,130),_root.randRange(75,100),"Green"]);
- _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-20,20),this.y + this.clip._height / 2 + _root.randRange(-20,20),_root.randRange(80,130),_root.randRange(75,100),"Blue"]);
- _root.audio.playLevel4("spaceManX" + (random(3) + 1),_root.randRange(15,25));
- var _loc5_ = 0;
- var _loc6_ = random(4) + 3;
- while(_loc5_ < _loc6_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"spaceManA","Yellow"]);
- _loc5_ = _loc5_ + 1;
- }
- _root.createEnemySoul([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"yellow"]);
- _root.removeChar("spaceManA" + this.id);
- }
- function advance()
- {
- this.dir = _root.advanceDir;
- this.xMovT = _root.advanceDir != "L" ? 1 * (this.speed / 2) : -1 * (this.speed / 2);
- this.clip.flame.gotoAndPlay("advance");
- this.f2 = "advancing";
- }
- function advancing()
- {
- this.c = this.c + 1;
- if(this.c > this.advanceMax)
- {
- this.xMovT = 0;
- this.c = 0;
- this.f2 = "wait";
- _root.d = _root.d + 1;
- _root.attachMovie("sight","sightClip",_root.d);
- _root.sightClip.gotoAndStop("hindSight");
- _root.sightClip._x = this.x;
- _root.sightClip._y = this.y;
- if(_root.advanceDir == "L")
- {
- _root.sightClip._rotation = 180;
- }
- if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
- {
- _root.broBehind();
- }
- removeMovieClip(_root.sightClip);
- }
- }
- function newDir()
- {
- if(random(10) > 1)
- {
- this[this.axis + "MovT"] = 0;
- this.dir = _root.getDir(this.x,this.y);
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.axis = random(10) <= 4 ? "y" : "x";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.getDirString();
- }
- }
- function newChargeDir()
- {
- if(random(10) > 1)
- {
- this.dir = _root.getDir(this.x,this.y);
- }
- else
- {
- this.dir = this.dirArray[random(4)];
- }
- }
- function wander()
- {
- if(random(100) > 95 + _root.dif.wander)
- {
- this.newDir();
- }
- else if(random(100) > 97)
- {
- if(this.dir == "U" || this.dir == "D")
- {
- this.laserScope();
- }
- else if(random(10) > 7)
- {
- this.charge();
- }
- }
- }
- function charge()
- {
- this.clip.body.gotoAndPlay("chargeStart");
- this.clip.flame.gotoAndPlay("charge");
- this.speed = this.speedOrig;
- this.speed *= 1.5;
- this.axis = "x";
- this.yMovT = 0;
- this[this.axis + "MovT"] = this.dir != "L" ? this.speed : -1 * this.speed;
- this.f2 = "charging";
- this.c = 0;
- this.cMax = _root.randRange(30,120);
- _root.audio.playLevel3("spaceManCharge",_root.randRange(25,35));
- }
- function charging()
- {
- if(random(100) > 95)
- {
- this.newChargeDir();
- }
- this.c = this.c + 1;
- if(this.c == this.cMax)
- {
- this.clip.body.gotoAndPlay("chargeEnd");
- this.clip.flame.gotoAndPlay("fly");
- this.speed = this.speedOrig;
- this[this.axis + "MovT"] = this.dir != "L" ? this.speed : -1 * this.speed;
- this.f2 = "wander";
- }
- }
- function laserScope()
- {
- this.laser.c = 0;
- this.laser.c2 = 0;
- this.laser.c2Max = _root.randRange(2,4);
- this.f2 = "laserScoping";
- this.speed /= 3;
- this[this.axis + "MovT"] /= 3;
- this.clip.body.head.gotoAndPlay("scope");
- this.clip.body.gotoAndStop("hover");
- _root.audio.playLevel2("spaceManWarning" + (random(3) + 1),_root.randRange(43,50));
- }
- function laserScoping()
- {
- this.laser.c = this.laser.c + 1;
- if(this.laser.c == 20)
- {
- this.laser.c2 = this.laser.c2 + 1;
- _root.d = _root.d + 1;
- _root.attachMovie("sight","sightClip",_root.d);
- _root.sightClip.gotoAndStop("bomberBLaser");
- _root.sightClip._x = this.x;
- _root.sightClip._y = this.y;
- if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
- {
- this.laser.dir = "L";
- this.fireLaser(false);
- }
- else
- {
- _root.sightClip._rotation = 180;
- if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
- {
- this.laser.dir = "R";
- this.fireLaser(false);
- }
- }
- removeMovieClip(_root.sightClip);
- this.laser.c = 0;
- }
- else if(this.laser.c2 >= this.laser.c2Max)
- {
- this.speed = this.speedOrig;
- this[this.axis + "MovT"] *= 3;
- this.f2 = "wander";
- this.clip.body.head.gotoAndPlay("front");
- }
- }
- function fireLaser(pmatrixed)
- {
- this.clip.gotoAndStop(this.laser.dir);
- this.clip.body.head.gotoAndStop("front");
- this.laser.matrixed = pmatrixed;
- this.f2 = "";
- this.clip.body.head.eyes.gotoAndPlay("glowStart");
- this.clip.body.hover.gotoAndPlay("topStart");
- this.laser.l = _root.randRange(5,25);
- this.laser.firing = true;
- this.laser.top = true;
- this.laser.c = 0;
- }
- function stopLaserFire()
- {
- this.laser.firing = false;
- this.clip.body.head.eyes.gotoAndPlay("glowEnd");
- if(this.laser.top)
- {
- this.clip.body.hover.gotoAndPlay("topEnd");
- }
- else
- {
- this.clip.body.hover.gotoAndPlay("botEnd");
- }
- if(!this.laser.matrixed)
- {
- this.speed = this.speedOrig;
- this[this.axis + "MovT"] *= 3;
- this.f2 = "wander";
- }
- }
- function death2()
- {
- _root.removeChar("spaceManA" + this.id);
- }
- function main()
- {
- this[this.f2]();
- if(this.oldDir != this.dir)
- {
- if(this.f2 != "charging" && this.oldDir != "matrix")
- {
- this.clip.gotoAndStop(this.dir);
- if(this.dir == "U")
- {
- this.clip.body.gotoAndPlay("flyEnd");
- this.clip.flame.gotoAndPlay("up2");
- }
- else if(this.dir == "D")
- {
- this.clip.body.gotoAndPlay("flyEnd");
- this.clip.flame.gotoAndStop("wait");
- }
- else if(this.f2 != "wait")
- {
- this.clip.body.gotoAndPlay("flyStart");
- this.clip.flame.gotoAndPlay("fly");
- }
- }
- else if(this.oldDir != "matrix")
- {
- this.clip.gotoAndStop(this.dir);
- if(this.oldDir == "L" || this.oldDir == "R")
- {
- if(this.dir == "U")
- {
- this.axis = "y";
- this.yMovT = -1 * this.speed;
- this.clip.body.gotoAndPlay("upStart");
- this.clip.flame.gotoAndPlay("upStart");
- }
- else if(this.dir == "D")
- {
- this.axis = "y";
- this.yMovT = this.speed;
- this.clip.body.gotoAndPlay("downStart");
- this.clip.flame.gotoAndPlay("downStart");
- }
- else
- {
- this.axis = "x";
- this.yMovT = 0;
- this.xMovT = this.dir != "L" ? this.speed : -1 * this.speed;
- this.clip.body.gotoAndPlay("chargeStart");
- this.clip.flame.gotoAndPlay("charge");
- }
- }
- else if(this.dir == "U")
- {
- this.axis = "y";
- this.xMovT = 0;
- this.clip.body.gotoAndPlay("hover");
- this.clip.flame.gotoAndPlay("up2");
- }
- else if(this.dir == "D")
- {
- this.axis = "y";
- this.xMovT = 0;
- this.clip.body.gotoAndPlay("downStart");
- this.clip.flame.gotoAndPlay("downStart");
- }
- else
- {
- this.axis = "x";
- this.xMovT = this.dir != "L" ? this.speed : -1 * this.speed;
- if(this.oldDir == "U")
- {
- this.clip.body.gotoAndPlay("upStart");
- this.clip.flame.gotoAndPlay("upStart");
- }
- else
- {
- this.clip.body.gotoAndPlay("downStart");
- this.clip.flame.gotoAndPlay("downStart");
- }
- }
- }
- }
- this.oldDir = this.dir;
- if(this.laser.firing)
- {
- this.laser.c = this.laser.c + 1;
- if(this.laser.c / 4 == Math.round(this.laser.c / 4))
- {
- if(this.laser.top)
- {
- this.laser.top = false;
- this.clip.body.hover.gotoAndPlay("topToBot");
- var _loc9_ = this.laser.dir != "L" ? -9 : -8;
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["spaceManALaser" + _root.enemyShotID] = new classes.shots.SpaceManALaser(this.x + _loc9_,this.y + 6,this.laser.c,this.laser.dir,_root.enemyShotID);
- _root.addEnemyShot("spaceManALaser" + _root.enemyShotID);
- }
- else
- {
- this.laser.top = true;
- this.clip.body.hover.gotoAndPlay("botToTop");
- _loc9_ = this.laser.dir != "L" ? 9 : -8;
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["spaceManALaser" + _root.enemyShotID] = new classes.shots.SpaceManALaser(this.x + _loc9_,this.y + 9,this.laser.c,this.laser.dir,_root.enemyShotID);
- _root.addEnemyShot("spaceManALaser" + _root.enemyShotID);
- }
- _root.audio.playLevel3("spaceManFire" + (random(5) + 1),_root.randRange(15,25));
- }
- if(this.laser.c > this.laser.l)
- {
- this.stopLaserFire();
- }
- }
- if(this.nudging)
- {
- this.xA *= 0.5;
- this.yA *= 0.5;
- this.nc = this.nc + 1;
- var _loc10_ = 255 - this.nc * 17;
- this.colorTrans.redOffset = _loc10_;
- this.colorTrans.greenMultiplier = this.nc / 15;
- this.colorTrans.blueMultiplier = this.nc / 15;
- this.trans.colorTransform = this.colorTrans;
- if(this.nc == 15)
- {
- this.xA = this.yA = 0;
- this.nudging = false;
- this.colorTrans.redOffset = this.colorR;
- this.colorTrans.greenMultiplier = 1;
- this.colorTrans.blueMultiplier = 1;
- this.trans.colorTransform = this.colorTrans;
- }
- }
- var _loc4_ = 0;
- var _loc7_ = _root.broShots.length;
- while(_loc4_ < _loc7_)
- {
- var _loc6_ = _root.broShots[_loc4_] + "Clip";
- if(this.clip.hitTest(_root[_loc6_]))
- {
- var _loc3_ = _root.broShots[_loc4_];
- var _loc5_ = this.life;
- this.life -= _root[_loc3_].power;
- _root.power = _root[_loc3_].power;
- _root.life = this.life;
- if(this.life < 1 || this.life == NaN)
- {
- this.f2 = "death";
- }
- else
- {
- this.nudge(_root[_loc3_].xMov,_root[_loc3_].yMov,5);
- if(random(3) == 0)
- {
- _root.audio.playLevel4("spaceManHit" + (random(3) + 1),_root.randRange(23,32));
- }
- else
- {
- _root.audio.playLevel2("spaceManHit" + (random(2) + 4),_root.randRange(15,20));
- }
- if(this.f2 == "wait" || this.f2 == "advancing")
- {
- this.matrixVar = 0;
- this.charge();
- }
- else if(this.f2 == "wander" || this.f2 == "laserScoping")
- {
- if(random(2) == 0)
- {
- this.speed = this.speedOrig;
- this[this.axis + "MovT"] = 0;
- this.axis = this.axis != "x" ? "x" : "y";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.getDirString();
- }
- else if(random(2) == 0)
- {
- this.axis = "x";
- this.dir = random(2) != 0 ? "R" : "L";
- this.charge();
- }
- }
- else if(this.f2 == "charging")
- {
- this.newChargeDir();
- }
- }
- _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
- _root[_loc3_].exploX = this.x + this.clip._width / 2;
- _root[_loc3_].exploY = this.y + this.clip._height / 2;
- _root[_loc3_].hit(_loc5_);
- break;
- }
- _loc4_ = _loc4_ + 1;
- }
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
- this.bombed(20);
- }
- if(!this.moveScripted)
- {
- var _loc8_ = false;
- if(this.x > 950)
- {
- _loc8_ = true;
- this.dir = "L";
- }
- else if(this.x < 50)
- {
- _loc8_ = true;
- this.dir = "R";
- }
- else if(this.y < 50)
- {
- _loc8_ = true;
- this.dir = "D";
- }
- else if(this.y > 550)
- {
- _loc8_ = true;
- this.dir = "U";
- }
- if(_loc8_)
- {
- this.xMovT = 0;
- this.yMovT = 0;
- this.speed = this.speedOrig;
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.f2 = "wander";
- }
- }
- if(this.x > 1100 || this.x < -100 || this.y < -100 || this.y > 700)
- {
- delete _root["form" + this.form[0]];
- delete _root["formB" + this.form[0]];
- this.f2 = "death2";
- }
- if(this.xMovT < this.xMov)
- {
- this.xMov -= 1;
- }
- else if(this.xMovT > this.xMov)
- {
- this.xMov += 1;
- }
- else
- {
- this.xMov = this.xMovT;
- }
- if(this.yMovT < this.yMov)
- {
- this.yMov -= 1;
- }
- else if(this.yMovT > this.yMov)
- {
- this.yMov += 1;
- }
- else
- {
- this.yMov = this.yMovT;
- }
- this.x += this.xMov + this.xA;
- this.y += this.yMov + this.yA + 0.5 * Math.sin(this.hc += 0.075);
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-